import 'package:get/get.dart';

import '../../core/global_service/global_service.dart';
import 'main_routes.dart';

/// 主页模块导航器
class MainNavigator {
  MainNavigator._();

  /// 跳转到主页
  static toHome<T>() {
    final globalService = Get.find<GlobalService>();
    globalService.setTabIndex(0);
    return Get.offAllNamed<T>(MainRoutes.main);
  }

  /// 跳转到我的
  static toMy<T>() {
    final globalService = Get.find<GlobalService>();
    globalService.setTabIndex(1);
    return Get.offAllNamed<T>(MainRoutes.main);
  }

  static back<T>([T? result]) {
    return Get.back(result: result);
  }
}
